home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
bbs
/
tdk_v136.zip
/
TDK_VARS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-08-14
|
13KB
|
286 lines
{
▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀ ▀▀
▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀ ▀▀▀ ▀▀▀▀▀ The DoorKit!
▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀▀▀▀▀ ▀▀ ▀▀
The BBS Door Development Kit By The People - For The People!
Feel free to modify or optimize this code at will. All I ask is that if
find a better way to do things (and you will), please send me a copy of
your modifications. Thanks in advance!....Larry L. Athey....
This is the variable/constant declaration unit.}
{$A+,B-,D+,E+,F+,G+,I-,L+,N-,O-,P-,Q-,R-,S-,T-,V+,X+}
UNIT TDK_VARS;
INTERFACE
USES DOS;
TYPE ControlFile = RECORD {Record of settings for each node}
Month : WORD; {The Month, Day, Year variables may be used at}
Day : WORD; {the programmers discretion. I use them in}
Year : WORD; {some doors to keep track of maintenance}
SFirst : STRING[20];{Sysop first name}
SLast : STRING[20];{Sysop last name}
SysSec : WORD; {Sysop security level on the BBS}
BBSname : STRING[40];{The name of the BBS}
SerialNumber : STRING[10];{Use this if you issue serial numbers}
HomePath : STRING[12];{BBS software home path, I use it for Shotgun}
UseFossil : BOOLEAN; {Use FOSSIL comm routines Yes/No}
PortSpeed : LONGINT; {Locked port speed (38000 max for FOSSIL)}
UseDigi : BOOLEAN; {Use DigiBoard comm routines? Yes/No}
WordSize : BYTE; {Data Bits (Normally set to 8)}
Parity : CHAR; {Parity O]dd E]ven N]one (Normally set to N)}
StopBits : BYTE; {Stop Bits (Normally set to 1)}
InBuffer : WORD; {Input buffer size (Default 512)}
OutBuffer : WORD; {Output buffer size (Default 1024)}
NSP : BOOLEAN; {Non-Standard port settings Yes/No}
Port : BYTE; {Comport number}
IRQ : BYTE; {Comport IRQ}
HexAddr : STRING[4]; {Comport Hex address}
END;
{NOTE: Not all settings in the control files are required. They are just
there in case you find a need for them. Adjust as needed....}
TYPE ColorScheme = RECORD {Record of system colors, expand this at will.}
Hfg, {Window header foreground}
Hbg, {Window header background}
Wbg, {Window background}
Sfg, {Window shadow foreground}
Sbg, {Window shadow background}
Wh, {Window highlight color}
Wl, {Window lowlight color}
Ffg, {Input field text foreground}
Fbg, {Input field text background}
Bfg, {Input field bracket foreground}
CPBfg, {CPrompt bracket foreground}
CPBbg, {CPrompt bracket background}
CPKfg, {CPrompt hotkey foreground}
CPKbg, {CPrompt hotkey background}
CPTfg, {CPrompt text foreground}
CPTbg, {CPrompt text background}
TxFG, {Text reader foreground}
TxBG : BYTE; {Text reader background}
END;
TYPE tWhichIO = (FossilIO,InternalIO,DigiIO);
{------------------------------------------------------------------------}
tDoor = RECORD {Record for the Door-System variables}
UserName : STRING[40];{User's real name}
Alias : STRING[40];{User's alias name}
PassWord : STRING[40];{User's password}
UserCity : STRING[40];{User's location}
Phone : STRING[15];{User's home/voice phone number}
WorkPhone : STRING[15];{User's work/data phone number}
BBSname : STRING[30];{The name of the BBS}
SysopName : STRING[30];{The name of this BBS's SysOp}
Access : WORD; {User's security level}
UserNumber : WORD; {User's record number}
Event : INTEGER; {Minutes until next event}
{------------------------------------------------------------------------}
Comport : BYTE; {Which Comport the program is using; 0=local}
BaudRate : LONGINT; {Actual baud rate for the comport}
LockBaud : LONGINT; {Locked port speed for the comport}
WhichIO : tWhichIO; {Which IO routines to use (fossil or internal)}
IOinstalled : BOOLEAN; {Comport IO routines installed?}
InBufSize : WORD; {Input buf size. (only for internal routines)}
OutBufSize : WORD; {Output buf size. (only for internal routines)}
IRQ : BYTE; {Which IRQ is being used}
WordSize : BYTE; {Wordsize (Data Bits) for comport}
Parity : CHAR; {Parity for comport; 'N'=none 'E'=even 'O'=odd}
StopBits : BYTE; {Stop Bits for comport}
Node : BYTE; {Which node the user is on}
{------------------------------------------------------------------------}
LocalInputON: BOOLEAN; {Enable/Disable local keyboard input}
{*} UpdateStatusBar: BOOLEAN;{Update status bar?}
{*} StatusBarY : BYTE; {What line the status bar is displayed on}
{*} LocalMaxY : BYTE; {# of lines (1-#) to update on local screen (usually 25)}
{------------------------------------------------------------------------}
SecondsLeft : LONGINT; {Seconds Left until user is booted back to BBS}
MinutesLeft : LONGINT; {Minutes Left until user is booted back to BBS}
{*} IdleCount : INTEGER; {How many seconds the user has been inactive}
UpdateSecs : BOOLEAN; {Update the user's remaining time?}
UpdateIdle : BOOLEAN; {Ckeck for user inactivity?}
{*} LocalKey : BOOLEAN; {Was the last key pressed local?}
{*} OnLine : BOOLEAN; {Is user online/connected?}
{------------------------------------------------------------------------}
END;
{* Variables marked with an asterisk are "Read-Only" and should never be
modified or altered by your code. AGAIN! - DO NOT TAMPER WITH THESE!}
CONST
_DOS = 0; { DOS }
OS2 = 1; { OS/2 }
WIN = 2; { WinDoze }
DV = 3; { DesqView }
CONST
WrapInput : BOOLEAN = FALSE;{Word wrap input fields Y/N?}
Local : BOOLEAN = TRUE; {Are we running in local mode?}
Tty = 0;
Ansi = 1;
Avatar = 2;
Rip = 3;
Max = 4;
Graphics : BYTE = Ansi; {Remote caller's graphics protocol}
ResetRemote : BOOLEAN = FALSE;{Send a !|1K|*|#|#|# at exit time?}
InChat : BOOLEAN = FALSE;{Are we currently in SysOp <> User Chat?}
UseDoorSys : BOOLEAN = TRUE; {Allow door to read DOOR.SYS?}
UseDorInfo : BOOLEAN = TRUE; {Allow door to read DORINFO#.DEF?}
UseMxUser : BOOLEAN = FALSE;{Allow door to read MX_USER.DAT?}
_HangUp : BOOLEAN = FALSE;{Lower DTR before terminating?}
HideParams : BOOLEAN = FALSE;{Hide information when exiting door?}
UseTTY : BOOLEAN = TRUE; {Allow ASCII/TTY callers in the door?}
KillDrop : BOOLEAN = FALSE;{Delete drop file before terminating?}
NoKill : BOOLEAN = FALSE;{Kill all MAX windows before sending new?}
IntConfig : BOOLEAN = FALSE;{Use internal configuration program?}
UseLocal : BOOLEAN = TRUE; {Allow local operation of the door?}
UseLog : BOOLEAN = FALSE;{Use activity logging?}
UseAd : BOOLEAN = TRUE; {Display program ad upon startup?}
ShowLog : BOOLEAN = FALSE;{Write activity logging to the screen? [Y/N]}
Wraplength : BYTE = 78; {The maximum word length for input driver.}
DVseg : WORD = $B800; {B800=Color, B000=Mono}
DVofs : WORD = $0000; {The OFS is needed in case I/You create routines
that will write to a virtual page, virtual pages
will not always start at 0000. For more exaples
of writing to virtual pages see ANSIUNIT.PAS}
TYPE CursorMoveType = RECORD
Up : ARRAY[Tty..Avatar] OF STRING[3];
Down : ARRAY[Tty..Avatar] OF STRING[3];
Right : ARRAY[Tty..Avatar] OF STRING[3];
Left : ARRAY[Tty..Avatar] OF STRING[3];
Home : ARRAY[Tty..Avatar] OF STRING[3];
Endkey : ARRAY[Tty..Avatar] OF STRING[3];
Insert : ARRAY[Tty..Avatar] OF STRING[3];
Delete : ARRAY[Tty..Avatar] OF STRING[3];
END;
CONST
CursorMove : CursorMoveType = (Up : (#0+#72,#27'[A',#22+#3);
Down : (#0+#80,#27'[B',#22+#4);
Right : (#0+#77,#27'[C',#22+#6);
Left : (#0+#75,#27'[D',#22+#5);
Home : (#0+#71,#27'[H',#22+#0);
EndKey : (#0+#79,#27'[K',#22+#0);
Insert : (#0+#82,#22,#22);
Delete : (#0+#83,#127,#127));
VAR
OS : BYTE; {Operating System: DOS, OS/2, WIN, DV}
CurTime : DATETIME; {The Current Time}
DropFilePath : STRING[80]; {Path to drop files}
Ctl : ControlFile;{Record for storing door setups per node}
CS : ColorScheme;{Record for storing various system colors}
DoorSys : tDoor; {Door-System record}
StartTime : DATETIME; {What time the user entered door}
BackSpaceChar : CHAR; {Character to use when the BS key is pressed}
LengthScr : BYTE; {Length of the remote caller's screen}
CurColor : BYTE; {Stores the last text attribute value.}
MiscFile : STRING[80]; {Miscellaneous file name passed with /F=}
MiscDesc : STRING[60]; {Miscellaneous file name command line desc}
LogPath : STRING[80]; {Path to write activity log file}
LogFile : STRING[40]; {Activity log file name (Room for variables)}
UFirst : STRING[20]; {User's first name}
ULast : STRING[20]; {User's last name}
Insert1 : STRING[79];
Insert2 : STRING[79];
Insert3 : STRING[79];
Insert4 : STRING[79];
Insert5 : STRING[79]; {Various "Dynamic" global system variables}
s_ReadKey : STRING[2]; {Local storage for sReadKey extended keys}
MaxID : STRING[4]; {Version of MAX Graphics the caller supports}
ProgramName : STRING[80]; {Name and version of the current program}
ProgramDesc : STRING[80]; {Description of the current program}
Copyright : STRING[80]; {Copyright to display in banner/ad screen}
ErrLevel : BYTE; {Errorlevel to exit the program with}
{-------------------------------------------------------------------------}
ClockResult : LONGINT; {These are for time keeping purposes only}
StopClock : LONGINT; {Do not mess with these or you could lock}
StartClock : LONGINT; {up your program....}
{───────────────────────────────────────────────────────────────────────────}
PROCEDURE DetectOS;
{^ Detects what operating system you are running.}
PROCEDURE TimeSlice;
{^ Gives up remaining CPU time to the rest of the OS. This procedure is set
up in the sReadkey function already, along with a few other procedures.
You can use it for your own needs as well.}
{───────────────────────────────────────────────────────────────────────────}
IMPLEMENTATION
{───────────────────────────────────────────────────────────────────────────}
PROCEDURE DetectOS; Assembler;
Asm
mov OS, _DOS { Default DOS }
mov ah, 30h { AH = 30h }
INT 21h { dos version }
cmp al, 14h
jae @IBMOS2 { Jump if >= to 20 }
mov ax,2B01h
mov cx,4445h
mov dx,5351h
INT 21h { Desqview Installed? }
cmp al, 255
jne @DesqView { Jump if AL <> 255 }
mov ax,160Ah
INT 2Fh { Windows Installed?}
cmp ax, 0h
je @Windows { If = Jump to Windows }
jmp @Finish { Nothing found, go to the end }
@IBMOS2 :
mov OS, Os2 { Set OS Value }
jmp @Finish
@DesqView :
mov OS, Dv { Set OS Value }
jmp @Finish
@Windows :
mov OS, win { Set OS Value }
jmp @Finish
@FINISH :
END;
{───────────────────────────────────────────────────────────────────────────}
PROCEDURE TimeSlice; Assembler;
Asm
CMP OS,_DOS { Compare to DOS }
JE @__DOS { Jump if = }
CMP OS,DV { Compare to Desqview }
JE @DESQVIEW { Jump if = }
CMP OS, WIN { Compare to Windows }
JE @WINOS2 { Jump if = }
CMP OS, OS2 { Compart OS/2 }
JE @WINOS2 { Jump if = }
JMP @NONE { None found, Jump to End }
@__DOS :
INT 28h { Interupt 28h }
JMP @NONE { Jump to the end }
@DESQVIEW :
MOV ax,1000h { AX = 1000h }
INT 15h { Call Interupt 15h }
JMP @NONE { Jump to the end }
@WINOS2 :
MOV AX, 1680h { AX = 1680h }
INT 2Fh { Call Interupt 2Fh for WinDoze-OS/2 TimeSlice }
@NONE :
END;
{───────────────────────────────────────────────────────────────────────────}
END.